package com.dbmanager;

public class DBDataSource
{
  private String name = "";
  private String jndiName = "";
  private String dbToServerEncodeCharset = "";
  private String dbToServerDecodeCharset = "";
  private boolean needConvertFromDbToServer = false;
  private String serverToDbEncodeCharset = "";
  private String serverToDbDecodeCharset = "";
  private boolean needConvertFromServerToDb = false;

  public DBDataSource(String name, String jndiName, String dbToServerEncodeCharset, String dbToServerDecodeCharset, boolean needConvertFromDbToServer, String serverToDbEncodeCharset, String serverToDbDecodeCharset, boolean needConvertFromServerToDb)
  {
    this.name = name;
    this.jndiName = jndiName;
    this.dbToServerEncodeCharset = dbToServerEncodeCharset;
    this.dbToServerDecodeCharset = dbToServerDecodeCharset;
    this.needConvertFromDbToServer = needConvertFromDbToServer;
    this.serverToDbEncodeCharset = serverToDbEncodeCharset;
    this.serverToDbDecodeCharset = serverToDbDecodeCharset;
    this.needConvertFromServerToDb = needConvertFromServerToDb;
    if (this.dbToServerDecodeCharset.equalsIgnoreCase(this.dbToServerEncodeCharset)) {
      this.needConvertFromDbToServer = false;
    }
    if (this.serverToDbDecodeCharset.equalsIgnoreCase(this.serverToDbEncodeCharset))
      this.needConvertFromServerToDb = false;
  }

  public String getDbToServerDecodeCharset()
  {
    return this.dbToServerDecodeCharset;
  }

  public String getDbToServerEncodeCharset()
  {
    return this.dbToServerEncodeCharset;
  }

  public String getJndiName()
  {
    return this.jndiName;
  }

  public String getName()
  {
    return this.name;
  }

  public boolean isNeedConvertFromDbToServer()
  {
    return this.needConvertFromDbToServer;
  }

  public boolean isNeedConvertFromServerToDb()
  {
    return this.needConvertFromServerToDb;
  }

  public String getServerToDbDecodeCharset()
  {
    return this.serverToDbDecodeCharset;
  }

  public String getServerToDbEncodeCharset()
  {
    return this.serverToDbEncodeCharset;
  }

  public String toString()
  {
    String value = "[name]=" + this.name + "\r\n" + "[jndiName]=" + this.jndiName + "\r\n" + "[dbToServerEncodeCharset]=" + this.dbToServerEncodeCharset + "\r\n" + "[dbToServerDecodeCharset]=" + this.dbToServerDecodeCharset + "\r\n" + "[needConvertFromDbToServer]=" + this.needConvertFromDbToServer + "\r\n" + "[serverToDbEncodeCharset]=" + this.serverToDbEncodeCharset + "\r\n" + "[serverToDbDecodeCharset]=" + this.serverToDbDecodeCharset + "\r\n" + "[needConvertFromServerToDb]=" + this.needConvertFromServerToDb;

    return value;
  }
}
